﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Popup_EqpFind.aspx.cs" Inherits="Popup_Popup_EqpFind" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>제목 없음</title>
    <link href="../CustomCss.css" rel="stylesheet" type="text/css" />
    <link href="../resources/css/examples.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .my-grid .x-grid3-scroller
        {
            overflow: scroll;
        }
    </style>
<ext:XScript ID="XScript1" runat="server">
    <script type="text/javascript">

        var CreateRow = function() {
            parent.SelectAddPeople(document.getElementById("hdRowValue").value);

            parent.Ext.getCmp('Window1').hide();
        }
        
        var Reload = function(){
            #{GridPanel1}.getStore().reload();
        }
        
        var AddGB = function () {
                var grid = #{GridPanel1};
                grid.stopEditing();
                var index =  #{Store1}.getCount();
                
                grid.insertRecord(index, {
                    
                });
                
                grid.getView().focusRow(index);
                grid.getView().focusCell(index,2);
                grid.selModel.selectRow(index);
                grid.startEditing(index,2);
            }
            
        var RemoveGB = function () {
            var grid = #{GridPanel1};
            grid.stopEditing();
            
            var s = grid.getSelectionModel().getSelections();
            
            for (var i = 0, r; r = s[i]; i++) {
                #{Store1}.remove(r);
            }
        }


       
       
    </script>
</ext:XScript>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <ext:Store ID="StrCbx" runat="server">
        <Reader>
            <ext:JsonReader IDProperty="CODE">
                <Fields>
                    <ext:RecordField Name="CODE" />
                    <ext:RecordField Name="CODENM" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Panel ID="Panel1" runat="server" Title="" AnchorVertical="20%" Width="250">
        <Content>
            <table style="width:100%;">
                <tr>
                    <td>
                        팀 명
                    </td>
                    <td>
                        <ext:ComboBox ID="cbxEqp" runat="server" StoreID="StrCbx" DisplayField="CODENM" ValueField="CODE">
                            <DirectEvents>
                                <Select OnEvent="ComboChange"></Select>
                            </DirectEvents>
                        </ext:ComboBox>
                    </td>
                    <td>
                        <ext:Button ID="btnReg" runat="server" Text="등록">
                            
                        </ext:Button>
                    </td>
                </tr>
            </table>
        </Content>
    </ext:Panel>
    <p>
    </p>
    <ext:GridPanel ID="GridPanel1" runat="server" AutoScroll="true" Height="250" Width="250" HideBorders="true"  HideHeaders="false" >
        <Store>
            <ext:Store ID="Store1" runat="server" OnRefreshData="Store_RefreshData" WarningOnDirty="false">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="EQUIP_KIND" />
                            <ext:RecordField Name="EQUIP_CD" />
                            <ext:RecordField Name="EQUIP_NM" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
                <Listeners>
                    <LoadException Handler="var e = e || {메시지: response.responseText}; alert('로드하지 못했습니다.: ' + e.message);" />
                </Listeners>
            </ext:Store>
        </Store>
        <View>
            <ext:GridView ID="GridView1" runat="server" />
        </View>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:RowNumbererColumn />
                <ext:Column ColumnID="EQUIP_KIND" Header="장비종류" Width="50" DataIndex="EQUIP_KIND" Hidden="true" />
                <ext:Column ColumnID="EQUIP_CD" Header="장비코드" Width="50" DataIndex="EQUIP_CD" Editable="false" />
                <ext:Column ColumnID="EQUIP_NM" Header="장비명" Width="100" DataIndex="EQUIP_NM" Editable="true">
                    <Editor>
                        <ext:TextField ID="tbxEqpName" runat="server" />
                    </Editor>
                </ext:Column>
            </Columns>
        </ColumnModel>
        <TopBar>
            <ext:Toolbar ID="Toolbar1" runat="server">
                <Items>
                    <ext:Button ID="Button4" runat="server" Text="추가" Icon="Add">
                        <Listeners>
                            <Click Fn="AddGB" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button25" runat="server" Text="삭제" Icon="Delete">
                        <Listeners>
                            <Click Fn="RemoveGB" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button26" runat="server" Text="저장" Icon="Disk">
                        <Listeners>
                            <Click Handler="#{GridPanel1}.save();" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button27" runat="server" Text="재조회" Icon="ArrowRefresh">
                        <Listeners>
                            <Click Handler="#{GridPanel1}.reload();" />
                        </Listeners>
                    </ext:Button>
                    <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                </Items>
            </ext:Toolbar>
        </TopBar>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                <DirectEvents>
                    <RowSelect OnEvent="CreateParameter">
                        <ExtraParams>
                            <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOnly:true}))" Mode="Raw" />
                        </ExtraParams>
                    </RowSelect>
                </DirectEvents>
            </ext:RowSelectionModel>
        </SelectionModel>
    </ext:GridPanel>
    <ext:Hidden ID="hdRowValue" runat="server" />
    <ext:Hidden ID="Hidden1" runat="server" />
    <ext:Hidden ID="hdPrjCD" runat="server" />
    <ext:Hidden ID="hdDT" runat="server" />
    <ext:Hidden ID="hdNotIn" runat="server" />
    <ext:Hidden ID="Hidden2" runat="server"  />
    <ext:Hidden ID="Hidden3" runat="server" />
    </form>
</body>
</html>
